window.onload=function(e){
    e=e||window.event;
    e.returnValue=false;

    //获取
    let center_right=document.querySelector(".center_right");
    let index_box=document.querySelector(".index_box");
    let even=document.querySelector(".even");
    let car=document.querySelector(".car");

    //事件委托
    index_box.onclick=function(e){

        //点击出现搜索框
        if(e.target.classList.contains("find")){
            center_right.style.right=0;
            // seach.style.zIndex=9;
            even.style.display='block';
        }

        //点击隐藏搜索页面
        if(e.target.classList.contains("cancle")){
            center_right.style.right="-511px";
            even.style.display='none';
        }

        if(e.target.classList.contains("shoppingcar")){
            let user=getCookie("login");
            if(!user){
                localStorage.setItem("url",location.href);
                confirm("请先登录!");
                if(confirm){
                    location.href="../html/login.html";
                    return;
                }
            }
            car.style.right=0;
            even.style.display='block';
        }

        if(e.target.classList.contains("quxiao")){
            car.style.right="-511px";
            even.style.display='none';

        }


    }
}